<?php

namespace App\Models;

use Dcat\Admin\Traits\HasDateTimeFormatter;

use Illuminate\Database\Eloquent\Model;

class YjPdf extends Model
{
   
    protected $table = 'yj_pdf';

    public static function getAllPDF($type = "", $message = "")
    {


        return self::where(function ($query) use ($message) {
            if ($message) {
                $query->where("notice", "like", "%$message%");
            }else{
                 $query->where("id",">",0) ;
            }
        })->where(function ($query) use ($type) {
            $query->where("type", $type);
        })->orderby("weight","desc")->get();
    }


}
